
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>安装 docker · docker swarm实践文档</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="Carey">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-emphasize/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-alerts/style.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-plus/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="compose_file.html" />
    
    
    <link rel="prev" href="环境准备.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="http://carey.akhack.com" target="_blank" class="custom-link">Home</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" >
            
                <span>
            
                    
                    基础环境
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="环境介绍.html">
            
                <a href="环境介绍.html">
            
                    
                    环境介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="环境准备.html">
            
                <a href="环境准备.html">
            
                    
                    基础准备
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2.3" data-path="安装docker.html">
            
                <a href="安装docker.html">
            
                    
                    安装 docker
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="compose_file.html">
            
                <a href="compose_file.html">
            
                    
                    compose file文档
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="registry仓库管理.html">
            
                <a href="registry仓库管理.html">
            
                    
                    registry管理
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    swarm 群集
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../swarm_book/创建群集.html">
            
                <a href="../swarm_book/创建群集.html">
            
                    
                    创建群集
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../swarm_book/portainer.html">
            
                <a href="../swarm_book/portainer.html">
            
                    
                    swarm管理工具Portainer
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../swarm_book/群集监控.html">
            
                <a href="../swarm_book/群集监控.html">
            
                    
                    cAdvisor InfluxDB Grafana搭建监控平台
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../swarm_book/telegraf.html">
            
                <a href="../swarm_book/telegraf.html">
            
                    
                    Telegraf监控容器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../swarm_book/Chronograf.html">
            
                <a href="../swarm_book/Chronograf.html">
            
                    
                    Chronograf显示监控数据
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" >
            
                <span>
            
                    
                    swarm service
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../service_book/nginx.html">
            
                <a href="../service_book/nginx.html">
            
                    
                    部署nginx服务
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    swarm stack
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../swarm_stack/lnmpwordpress.html">
            
                <a href="../swarm_stack/lnmpwordpress.html">
            
                    
                    部署wordpress
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../swarm_stack/build_eureka.md">
            
                <span>
            
                    
                    部署eureka
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >安装 docker</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div class="search-plus" id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x5B89;&#x88C5;docker">&#x5B89;&#x88C5;docker</h1>
<h2 id="&#x5378;&#x8F7D;&#x65E7;&#x7248;&#x672C;">&#x5378;&#x8F7D;&#x65E7;&#x7248;&#x672C;</h2>
<p>&#x8001;&#x7248;&#x672C;&#x7684;Docker&#x88AB;&#x79F0;&#x4E3A;<code>docker</code>&#x6216;<code>docker-engine</code>&#x3002;&#x5982;&#x679C;&#x5B89;&#x88C5;&#x4E86;&#x5B83;&#x4EEC;&#xFF0C;&#x8BF7;&#x5378;&#x8F7D;&#x5B83;&#x4EEC;&#x4EE5;&#x53CA;&#x76F8;&#x5173;&#x7684;&#x4F9D;&#x8D56;&#x9879;&#x3002;</p>
<pre><code>$ yum remove docker \
                  docker-common \
                  docker-selinux \
                  docker-engine
</code></pre><h2 id="&#x5B89;&#x88C5;&#x6240;&#x9700;&#x7684;&#x5305;">&#x5B89;&#x88C5;&#x6240;&#x9700;&#x7684;&#x5305;</h2>
<p><code>yum-utils</code>&#x63D0;&#x4F9B;&#x4E86;<code>yum-config-manager</code> &#x6548;&#x7528;&#xFF0C;&#x5E76;<code>device-mapper-persistent-data</code>&#x548C;<code>lvm2</code>&#x7531;&#x9700;&#x8981; `devicemapper&#x5B58;&#x50A8;&#x9A71;&#x52A8;&#x7A0B;&#x5E8F;&#x3002;</p>
<pre><code>$ yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2
</code></pre><h2 id="&#x8BBE;&#x7F6E;-yum-&#x5B98;&#x65B9;&#x6E90;">&#x8BBE;&#x7F6E; yum &#x5B98;&#x65B9;&#x6E90;</h2>
<pre><code>$ yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
</code></pre><blockquote>
<p><strong>[warning] &#x5B98;&#x65B9;&#x6E90;&#x7ECF;&#x5E38;&#x51FA;&#x73B0;&#x88AB;&#x5899;&#x7684;&#x60C5;&#x51B5;&#xFF0C;&#x53EF;&#x9009;&#x62E9;&#x963F;&#x91CC;&#x4E91;&#x7684;&#x6E90;</strong></p>
</blockquote>
<pre><code>$ yum-config-manager \
    --add-repo \
    http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
</code></pre><h2 id="&#x5B89;&#x88C5;docker-ce">&#x5B89;&#x88C5;docker ce</h2>
<pre><code>$ yum install docker-ce -y
</code></pre><h2 id="&#x914D;&#x7F6E;&#x955C;&#x50CF;&#x52A0;&#x901F;&#x5668;">&#x914D;&#x7F6E;&#x955C;&#x50CF;&#x52A0;&#x901F;&#x5668;</h2>
<p>&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x4FEE;&#x6539;<code>daemon</code>&#x914D;&#x7F6E;&#x6587;&#x4EF6;<code>/etc/docker/daemon.json</code>&#x6765;&#x4F7F;&#x7528;&#x52A0;&#x901F;&#x5668;</p>
<pre><code>$ mkdir -p /etc/docker
$ tee /etc/docker/daemon.json &lt;&lt;-&apos;EOF&apos;
{
  &quot;registry-mirrors&quot;: [&quot;https://registry.docker-cn.com&quot;]
}
EOF
$ systemctl daemon-reload
$ systemctl restart docker
</code></pre>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="环境准备.html" class="navigation navigation-prev " aria-label="Previous page: 基础准备">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="compose_file.html" class="navigation navigation-next " aria-label="Next page: compose file文档">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"安装 docker","level":"1.2.3","depth":2,"next":{"title":"compose file文档","level":"1.2.4","depth":2,"path":"base_book/compose_file.md","ref":"base_book/compose_file.md","articles":[]},"previous":{"title":"基础准备","level":"1.2.2","depth":2,"path":"base_book/环境准备.md","ref":"base_book/环境准备.md","articles":[]},"dir":"ltr"},"config":{"plugins":["emphasize","alerts","code","-lunr","-search","search-plus","splitter"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"emphasize":{},"splitter":{},"code":{"copyButtons":true},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"alerts":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"search-plus":{}},"theme":"default","author":"Carey","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"docker swarm实践文档","language":"zh-hans","links":{"sidebar":{"Home":"http://carey.akhack.com"}},"gitbook":"*"},"file":{"path":"base_book/安装docker.md","mtime":"2018-07-06T03:01:13.253Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-12-04T03:25:36.834Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-alerts/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

